package com.ruoyi.auth.controller;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.common.security.service.TokenService;
import com.ruoyi.system.api.model.LoginUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/route")
public class RouteController {
    @Autowired
    private TokenService tokenService;

    /**
     * 获取用户路由数据
     *
     * @param request
     * @return
     */
    @GetMapping("getUserRoutes")
    public R<?> getUserRoutes(HttpServletRequest request){
        String jsonStr = "{\n" +
                "        \"routes\": [\n" +
                "            {\n" +
                "                \"name\": \"403\",\n" +
                "                \"path\": \"/403\",\n" +
                "                \"component\": \"layout.blank$view.403\",\n" +
                "                \"meta\": {\n" +
                "                    \"title\": \"403\",\n" +
                "                    \"i18nKey\": \"route.403\",\n" +
                "                    \"constant\": true,\n" +
                "                    \"hideInMenu\": true\n" +
                "                }\n" +
                "            },\n" +
                "            {\n" +
                "                \"name\": \"404\",\n" +
                "                \"path\": \"/404\",\n" +
                "                \"component\": \"layout.blank$view.404\",\n" +
                "                \"meta\": {\n" +
                "                    \"title\": \"404\",\n" +
                "                    \"i18nKey\": \"route.404\",\n" +
                "                    \"constant\": true,\n" +
                "                    \"hideInMenu\": true\n" +
                "                }\n" +
                "            },\n" +
                "            {\n" +
                "                \"name\": \"500\",\n" +
                "                \"path\": \"/500\",\n" +
                "                \"component\": \"layout.blank$view.500\",\n" +
                "                \"meta\": {\n" +
                "                    \"title\": \"500\",\n" +
                "                    \"i18nKey\": \"route.500\",\n" +
                "                    \"constant\": true,\n" +
                "                    \"hideInMenu\": true\n" +
                "                }\n" +
                "            },\n" +
                "            {\n" +
                "                \"name\": \"about\",\n" +
                "                \"path\": \"/about\",\n" +
                "                \"component\": \"layout.base$view.about\",\n" +
                "                \"meta\": {\n" +
                "                    \"title\": \"about\",\n" +
                "                    \"i18nKey\": \"route.about\",\n" +
                "                    \"icon\": \"fluent:book-information-24-regular\",\n" +
                "                    \"order\": 10\n" +
                "                }\n" +
                "            },\n" +
                "            {\n" +
                "                \"name\": \"alova\",\n" +
                "                \"path\": \"/alova\",\n" +
                "                \"component\": \"layout.base\",\n" +
                "                \"meta\": {\n" +
                "                    \"title\": \"alova\",\n" +
                "                    \"i18nKey\": \"route.alova\",\n" +
                "                    \"icon\": \"carbon:http\",\n" +
                "                    \"order\": 7\n" +
                "                },\n" +
                "                \"children\": [\n" +
                "                    {\n" +
                "                        \"name\": \"alova_request\",\n" +
                "                        \"path\": \"/alova/request\",\n" +
                "                        \"component\": \"view.alova_request\",\n" +
                "                        \"meta\": {\n" +
                "                            \"title\": \"alova_request\",\n" +
                "                            \"i18nKey\": \"route.alova_request\",\n" +
                "                            \"order\": 1\n" +
                "                        }\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"name\": \"alova_scenes\",\n" +
                "                        \"path\": \"/alova/scenes\",\n" +
                "                        \"component\": \"view.alova_scenes\",\n" +
                "                        \"meta\": {\n" +
                "                            \"title\": \"alova_scenes\",\n" +
                "                            \"i18nKey\": \"route.alova_scenes\",\n" +
                "                            \"icon\": \"cbi:scene-dynamic\",\n" +
                "                            \"order\": 3\n" +
                "                        }\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"name\": \"alova_user\",\n" +
                "                        \"path\": \"/alova/user\",\n" +
                "                        \"component\": \"view.alova_user\",\n" +
                "                        \"meta\": {\n" +
                "                            \"title\": \"alova_user\",\n" +
                "                            \"i18nKey\": \"route.alova_user\",\n" +
                "                            \"icon\": \"carbon:user-multiple\",\n" +
                "                            \"order\": 2\n" +
                "                        }\n" +
                "                    }\n" +
                "                ]\n" +
                "            },\n" +
                "            {\n" +
                "                \"name\": \"function\",\n" +
                "                \"path\": \"/function\",\n" +
                "                \"component\": \"layout.base\",\n" +
                "                \"meta\": {\n" +
                "                    \"title\": \"function\",\n" +
                "                    \"i18nKey\": \"route.function\",\n" +
                "                    \"icon\": \"icon-park-outline:all-application\",\n" +
                "                    \"order\": 6\n" +
                "                },\n" +
                "                \"children\": [\n" +
                "                    {\n" +
                "                        \"name\": \"function_hide-child\",\n" +
                "                        \"path\": \"/function/hide-child\",\n" +
                "                        \"meta\": {\n" +
                "                            \"title\": \"function_hide-child\",\n" +
                "                            \"i18nKey\": \"route.function_hide-child\",\n" +
                "                            \"icon\": \"material-symbols:filter-list-off\",\n" +
                "                            \"order\": 2\n" +
                "                        },\n" +
                "                        \"redirect\": \"/function/hide-child/one\",\n" +
                "                        \"children\": [\n" +
                "                            {\n" +
                "                                \"name\": \"function_hide-child_one\",\n" +
                "                                \"path\": \"/function/hide-child/one\",\n" +
                "                                \"component\": \"view.function_hide-child_one\",\n" +
                "                                \"meta\": {\n" +
                "                                    \"title\": \"function_hide-child_one\",\n" +
                "                                    \"i18nKey\": \"route.function_hide-child_one\",\n" +
                "                                    \"icon\": \"material-symbols:filter-list-off\",\n" +
                "                                    \"hideInMenu\": true,\n" +
                "                                    \"activeMenu\": \"function_hide-child\"\n" +
                "                                }\n" +
                "                            },\n" +
                "                            {\n" +
                "                                \"name\": \"function_hide-child_three\",\n" +
                "                                \"path\": \"/function/hide-child/three\",\n" +
                "                                \"component\": \"view.function_hide-child_three\",\n" +
                "                                \"meta\": {\n" +
                "                                    \"title\": \"function_hide-child_three\",\n" +
                "                                    \"i18nKey\": \"route.function_hide-child_three\",\n" +
                "                                    \"hideInMenu\": true,\n" +
                "                                    \"activeMenu\": \"function_hide-child\"\n" +
                "                                }\n" +
                "                            },\n" +
                "                            {\n" +
                "                                \"name\": \"function_hide-child_two\",\n" +
                "                                \"path\": \"/function/hide-child/two\",\n" +
                "                                \"component\": \"view.function_hide-child_two\",\n" +
                "                                \"meta\": {\n" +
                "                                    \"title\": \"function_hide-child_two\",\n" +
                "                                    \"i18nKey\": \"route.function_hide-child_two\",\n" +
                "                                    \"hideInMenu\": true,\n" +
                "                                    \"activeMenu\": \"function_hide-child\"\n" +
                "                                }\n" +
                "                            }\n" +
                "                        ]\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"name\": \"function_multi-tab\",\n" +
                "                        \"path\": \"/function/multi-tab\",\n" +
                "                        \"component\": \"view.function_multi-tab\",\n" +
                "                        \"meta\": {\n" +
                "                            \"title\": \"function_multi-tab\",\n" +
                "                            \"i18nKey\": \"route.function_multi-tab\",\n" +
                "                            \"icon\": \"ic:round-tab\",\n" +
                "                            \"multiTab\": true,\n" +
                "                            \"hideInMenu\": true,\n" +
                "                            \"activeMenu\": \"function_tab\"\n" +
                "                        }\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"name\": \"function_request\",\n" +
                "                        \"path\": \"/function/request\",\n" +
                "                        \"component\": \"view.function_request\",\n" +
                "                        \"meta\": {\n" +
                "                            \"title\": \"function_request\",\n" +
                "                            \"i18nKey\": \"route.function_request\",\n" +
                "                            \"icon\": \"carbon:network-overlay\",\n" +
                "                            \"order\": 3\n" +
                "                        }\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"name\": \"function_super-page\",\n" +
                "                        \"path\": \"/function/super-page\",\n" +
                "                        \"component\": \"view.function_super-page\",\n" +
                "                        \"meta\": {\n" +
                "                            \"title\": \"function_super-page\",\n" +
                "                            \"i18nKey\": \"route.function_super-page\",\n" +
                "                            \"icon\": \"ic:round-supervisor-account\",\n" +
                "                            \"order\": 5\n" +
                "                        }\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"name\": \"function_tab\",\n" +
                "                        \"path\": \"/function/tab\",\n" +
                "                        \"component\": \"view.function_tab\",\n" +
                "                        \"meta\": {\n" +
                "                            \"title\": \"function_tab\",\n" +
                "                            \"i18nKey\": \"route.function_tab\",\n" +
                "                            \"icon\": \"ic:round-tab\",\n" +
                "                            \"order\": 1\n" +
                "                        }\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"name\": \"function_toggle-auth\",\n" +
                "                        \"path\": \"/function/toggle-auth\",\n" +
                "                        \"component\": \"view.function_toggle-auth\",\n" +
                "                        \"meta\": {\n" +
                "                            \"title\": \"function_toggle-auth\",\n" +
                "                            \"i18nKey\": \"route.function_toggle-auth\",\n" +
                "                            \"icon\": \"ic:round-construction\",\n" +
                "                            \"order\": 4\n" +
                "                        }\n" +
                "                    }\n" +
                "                ]\n" +
                "            },\n" +
                "            {\n" +
                "                \"name\": \"home\",\n" +
                "                \"path\": \"/home\",\n" +
                "                \"component\": \"layout.base$view.home\",\n" +
                "                \"meta\": {\n" +
                "                    \"title\": \"home\",\n" +
                "                    \"i18nKey\": \"route.home\",\n" +
                "                    \"icon\": \"mdi:monitor-dashboard\",\n" +
                "                    \"order\": 1\n" +
                "                }\n" +
                "            },\n" +
                "            {\n" +
                "                \"name\": \"iframe-page\",\n" +
                "                \"path\": \"/iframe-page/:url\",\n" +
                "                \"component\": \"layout.base$view.iframe-page\",\n" +
                "                \"props\": true,\n" +
                "                \"meta\": {\n" +
                "                    \"title\": \"iframe-page\",\n" +
                "                    \"i18nKey\": \"route.iframe-page\",\n" +
                "                    \"constant\": true,\n" +
                "                    \"hideInMenu\": true,\n" +
                "                    \"keepAlive\": true\n" +
                "                }\n" +
                "            },\n" +
                "            {\n" +
                "                \"name\": \"login\",\n" +
                "                \"path\": \"/login/:module(pwd-login|code-login|register|reset-pwd|bind-wechat)?\",\n" +
                "                \"component\": \"layout.blank$view.login\",\n" +
                "                \"props\": true,\n" +
                "                \"meta\": {\n" +
                "                    \"title\": \"login\",\n" +
                "                    \"i18nKey\": \"route.login\",\n" +
                "                    \"constant\": true,\n" +
                "                    \"hideInMenu\": true\n" +
                "                }\n" +
                "            },\n" +
                "            {\n" +
                "                \"name\": \"manage\",\n" +
                "                \"path\": \"/manage\",\n" +
                "                \"component\": \"layout.base\",\n" +
                "                \"meta\": {\n" +
                "                    \"title\": \"manage\",\n" +
                "                    \"i18nKey\": \"route.manage\",\n" +
                "                    \"icon\": \"carbon:cloud-service-management\",\n" +
                "                    \"order\": 9\n" +
                "                },\n" +
                "                \"children\": [\n" +
                "                    {\n" +
                "                        \"name\": \"manage_menu\",\n" +
                "                        \"path\": \"/manage/menu\",\n" +
                "                        \"component\": \"view.manage_menu\",\n" +
                "                        \"meta\": {\n" +
                "                            \"title\": \"manage_menu\",\n" +
                "                            \"i18nKey\": \"route.manage_menu\",\n" +
                "                            \"icon\": \"material-symbols:route\",\n" +
                "                            \"order\": 3,\n" +
                "                            \"keepAlive\": true\n" +
                "                        }\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"name\": \"manage_role\",\n" +
                "                        \"path\": \"/manage/role\",\n" +
                "                        \"component\": \"view.manage_role\",\n" +
                "                        \"meta\": {\n" +
                "                            \"title\": \"manage_role\",\n" +
                "                            \"i18nKey\": \"route.manage_role\",\n" +
                "                            \"icon\": \"carbon:user-role\",\n" +
                "                            \"order\": 2\n" +
                "                        }\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"name\": \"manage_user\",\n" +
                "                        \"path\": \"/manage/user\",\n" +
                "                        \"component\": \"view.manage_user\",\n" +
                "                        \"meta\": {\n" +
                "                            \"title\": \"manage_user\",\n" +
                "                            \"i18nKey\": \"route.manage_user\",\n" +
                "                            \"icon\": \"ic:round-manage-accounts\",\n" +
                "                            \"order\": 1\n" +
                "                        }\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"name\": \"manage_user-detail\",\n" +
                "                        \"path\": \"/manage/user-detail/:id\",\n" +
                "                        \"component\": \"view.manage_user-detail\",\n" +
                "                        \"props\": true,\n" +
                "                        \"meta\": {\n" +
                "                            \"title\": \"manage_user-detail\",\n" +
                "                            \"i18nKey\": \"route.manage_user-detail\",\n" +
                "                            \"hideInMenu\": true,\n" +
                "                            \"activeMenu\": \"manage_user\"\n" +
                "                        }\n" +
                "                    }\n" +
                "                ]\n" +
                "            },\n" +
                "            {\n" +
                "                \"name\": \"multi-menu\",\n" +
                "                \"path\": \"/multi-menu\",\n" +
                "                \"component\": \"layout.base\",\n" +
                "                \"meta\": {\n" +
                "                    \"title\": \"multi-menu\",\n" +
                "                    \"i18nKey\": \"route.multi-menu\",\n" +
                "                    \"order\": 8\n" +
                "                },\n" +
                "                \"children\": [\n" +
                "                    {\n" +
                "                        \"name\": \"multi-menu_first\",\n" +
                "                        \"path\": \"/multi-menu/first\",\n" +
                "                        \"meta\": {\n" +
                "                            \"title\": \"multi-menu_first\",\n" +
                "                            \"i18nKey\": \"route.multi-menu_first\",\n" +
                "                            \"order\": 1\n" +
                "                        },\n" +
                "                        \"children\": [\n" +
                "                            {\n" +
                "                                \"name\": \"multi-menu_first_child\",\n" +
                "                                \"path\": \"/multi-menu/first/child\",\n" +
                "                                \"component\": \"view.multi-menu_first_child\",\n" +
                "                                \"meta\": {\n" +
                "                                    \"title\": \"multi-menu_first_child\",\n" +
                "                                    \"i18nKey\": \"route.multi-menu_first_child\"\n" +
                "                                }\n" +
                "                            }\n" +
                "                        ]\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"name\": \"multi-menu_second\",\n" +
                "                        \"path\": \"/multi-menu/second\",\n" +
                "                        \"meta\": {\n" +
                "                            \"title\": \"multi-menu_second\",\n" +
                "                            \"i18nKey\": \"route.multi-menu_second\",\n" +
                "                            \"order\": 2\n" +
                "                        },\n" +
                "                        \"children\": [\n" +
                "                            {\n" +
                "                                \"name\": \"multi-menu_second_child\",\n" +
                "                                \"path\": \"/multi-menu/second/child\",\n" +
                "                                \"meta\": {\n" +
                "                                    \"title\": \"multi-menu_second_child\",\n" +
                "                                    \"i18nKey\": \"route.multi-menu_second_child\"\n" +
                "                                },\n" +
                "                                \"children\": [\n" +
                "                                    {\n" +
                "                                        \"name\": \"multi-menu_second_child_home\",\n" +
                "                                        \"path\": \"/multi-menu/second/child/home\",\n" +
                "                                        \"component\": \"view.multi-menu_second_child_home\",\n" +
                "                                        \"meta\": {\n" +
                "                                            \"title\": \"multi-menu_second_child_home\",\n" +
                "                                            \"i18nKey\": \"route.multi-menu_second_child_home\"\n" +
                "                                        }\n" +
                "                                    }\n" +
                "                                ]\n" +
                "                            }\n" +
                "                        ]\n" +
                "                    }\n" +
                "                ]\n" +
                "            },\n" +
                "            {\n" +
                "                \"name\": \"plugin\",\n" +
                "                \"path\": \"/plugin\",\n" +
                "                \"component\": \"layout.base\",\n" +
                "                \"meta\": {\n" +
                "                    \"title\": \"插件示例\",\n" +
                "                    \"i18nKey\": \"route.plugin\",\n" +
                "                    \"order\": 7,\n" +
                "                    \"icon\": \"clarity:plugin-line\"\n" +
                "                },\n" +
                "                \"children\": [\n" +
                "                    {\n" +
                "                        \"name\": \"plugin_barcode\",\n" +
                "                        \"path\": \"/plugin/barcode\",\n" +
                "                        \"component\": \"view.plugin_barcode\",\n" +
                "                        \"meta\": {\n" +
                "                            \"title\": \"plugin_barcode\",\n" +
                "                            \"i18nKey\": \"route.plugin_barcode\",\n" +
                "                            \"icon\": \"ic:round-barcode\"\n" +
                "                        }\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"name\": \"plugin_charts\",\n" +
                "                        \"path\": \"/plugin/charts\",\n" +
                "                        \"meta\": {\n" +
                "                            \"title\": \"plugin_charts\",\n" +
                "                            \"i18nKey\": \"route.plugin_charts\",\n" +
                "                            \"icon\": \"mdi:chart-areaspline\"\n" +
                "                        },\n" +
                "                        \"children\": [\n" +
                "                            {\n" +
                "                                \"name\": \"plugin_charts_antv\",\n" +
                "                                \"path\": \"/plugin/charts/antv\",\n" +
                "                                \"component\": \"view.plugin_charts_antv\",\n" +
                "                                \"meta\": {\n" +
                "                                    \"title\": \"plugin_charts_antv\",\n" +
                "                                    \"i18nKey\": \"route.plugin_charts_antv\",\n" +
                "                                    \"icon\": \"hugeicons:flow-square\"\n" +
                "                                }\n" +
                "                            },\n" +
                "                            {\n" +
                "                                \"name\": \"plugin_charts_echarts\",\n" +
                "                                \"path\": \"/plugin/charts/echarts\",\n" +
                "                                \"component\": \"view.plugin_charts_echarts\",\n" +
                "                                \"meta\": {\n" +
                "                                    \"title\": \"plugin_charts_echarts\",\n" +
                "                                    \"i18nKey\": \"route.plugin_charts_echarts\",\n" +
                "                                    \"icon\": \"simple-icons:apacheecharts\"\n" +
                "                                }\n" +
                "                            },\n" +
                "                            {\n" +
                "                                \"name\": \"plugin_charts_vchart\",\n" +
                "                                \"path\": \"/plugin/charts/vchart\",\n" +
                "                                \"component\": \"view.plugin_charts_vchart\",\n" +
                "                                \"meta\": {\n" +
                "                                    \"title\": \"plugin_charts_vchart\",\n" +
                "                                    \"i18nKey\": \"route.plugin_charts_vchart\",\n" +
                "                                    \"localIcon\": \"visactor\"\n" +
                "                                }\n" +
                "                            }\n" +
                "                        ]\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"name\": \"plugin_copy\",\n" +
                "                        \"path\": \"/plugin/copy\",\n" +
                "                        \"component\": \"view.plugin_copy\",\n" +
                "                        \"meta\": {\n" +
                "                            \"title\": \"plugin_copy\",\n" +
                "                            \"i18nKey\": \"route.plugin_copy\",\n" +
                "                            \"icon\": \"mdi:clipboard-outline\"\n" +
                "                        }\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"name\": \"plugin_editor\",\n" +
                "                        \"path\": \"/plugin/editor\",\n" +
                "                        \"meta\": {\n" +
                "                            \"title\": \"plugin_editor\",\n" +
                "                            \"i18nKey\": \"route.plugin_editor\",\n" +
                "                            \"icon\": \"icon-park-outline:editor\"\n" +
                "                        },\n" +
                "                        \"children\": [\n" +
                "                            {\n" +
                "                                \"name\": \"plugin_editor_markdown\",\n" +
                "                                \"path\": \"/plugin/editor/markdown\",\n" +
                "                                \"component\": \"view.plugin_editor_markdown\",\n" +
                "                                \"meta\": {\n" +
                "                                    \"title\": \"plugin_editor_markdown\",\n" +
                "                                    \"i18nKey\": \"route.plugin_editor_markdown\",\n" +
                "                                    \"icon\": \"ri:markdown-line\"\n" +
                "                                }\n" +
                "                            },\n" +
                "                            {\n" +
                "                                \"name\": \"plugin_editor_quill\",\n" +
                "                                \"path\": \"/plugin/editor/quill\",\n" +
                "                                \"component\": \"view.plugin_editor_quill\",\n" +
                "                                \"meta\": {\n" +
                "                                    \"title\": \"plugin_editor_quill\",\n" +
                "                                    \"i18nKey\": \"route.plugin_editor_quill\",\n" +
                "                                    \"icon\": \"mdi:file-document-edit-outline\"\n" +
                "                                }\n" +
                "                            }\n" +
                "                        ]\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"name\": \"plugin_excel\",\n" +
                "                        \"path\": \"/plugin/excel\",\n" +
                "                        \"component\": \"view.plugin_excel\",\n" +
                "                        \"meta\": {\n" +
                "                            \"title\": \"plugin_excel\",\n" +
                "                            \"i18nKey\": \"route.plugin_excel\",\n" +
                "                            \"icon\": \"ri:file-excel-2-line\",\n" +
                "                            \"keepAlive\": true\n" +
                "                        }\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"name\": \"plugin_gantt\",\n" +
                "                        \"path\": \"/plugin/gantt\",\n" +
                "                        \"meta\": {\n" +
                "                            \"title\": \"plugin_gantt\",\n" +
                "                            \"i18nKey\": \"route.plugin_gantt\",\n" +
                "                            \"icon\": \"ant-design:bar-chart-outlined\"\n" +
                "                        },\n" +
                "                        \"children\": [\n" +
                "                            {\n" +
                "                                \"name\": \"plugin_gantt_dhtmlx\",\n" +
                "                                \"path\": \"/plugin/gantt/dhtmlx\",\n" +
                "                                \"component\": \"view.plugin_gantt_dhtmlx\",\n" +
                "                                \"meta\": {\n" +
                "                                    \"title\": \"plugin_gantt_dhtmlx\",\n" +
                "                                    \"i18nKey\": \"route.plugin_gantt_dhtmlx\"\n" +
                "                                }\n" +
                "                            },\n" +
                "                            {\n" +
                "                                \"name\": \"plugin_gantt_vtable\",\n" +
                "                                \"path\": \"/plugin/gantt/vtable\",\n" +
                "                                \"component\": \"view.plugin_gantt_vtable\",\n" +
                "                                \"meta\": {\n" +
                "                                    \"title\": \"plugin_gantt_vtable\",\n" +
                "                                    \"i18nKey\": \"route.plugin_gantt_vtable\",\n" +
                "                                    \"localIcon\": \"visactor\"\n" +
                "                                }\n" +
                "                            }\n" +
                "                        ]\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"name\": \"plugin_icon\",\n" +
                "                        \"path\": \"/plugin/icon\",\n" +
                "                        \"component\": \"view.plugin_icon\",\n" +
                "                        \"meta\": {\n" +
                "                            \"title\": \"plugin_icon\",\n" +
                "                            \"i18nKey\": \"route.plugin_icon\",\n" +
                "                            \"localIcon\": \"custom-icon\"\n" +
                "                        }\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"name\": \"plugin_map\",\n" +
                "                        \"path\": \"/plugin/map\",\n" +
                "                        \"component\": \"view.plugin_map\",\n" +
                "                        \"meta\": {\n" +
                "                            \"title\": \"plugin_map\",\n" +
                "                            \"i18nKey\": \"route.plugin_map\",\n" +
                "                            \"icon\": \"mdi:map\"\n" +
                "                        }\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"name\": \"plugin_pdf\",\n" +
                "                        \"path\": \"/plugin/pdf\",\n" +
                "                        \"component\": \"view.plugin_pdf\",\n" +
                "                        \"meta\": {\n" +
                "                            \"title\": \"plugin_pdf\",\n" +
                "                            \"i18nKey\": \"route.plugin_pdf\",\n" +
                "                            \"icon\": \"uiw:file-pdf\"\n" +
                "                        }\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"name\": \"plugin_pinyin\",\n" +
                "                        \"path\": \"/plugin/pinyin\",\n" +
                "                        \"component\": \"view.plugin_pinyin\",\n" +
                "                        \"meta\": {\n" +
                "                            \"title\": \"plugin_pinyin\",\n" +
                "                            \"i18nKey\": \"route.plugin_pinyin\",\n" +
                "                            \"icon\": \"entypo-social:google-hangouts\"\n" +
                "                        }\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"name\": \"plugin_print\",\n" +
                "                        \"path\": \"/plugin/print\",\n" +
                "                        \"component\": \"view.plugin_print\",\n" +
                "                        \"meta\": {\n" +
                "                            \"title\": \"plugin_print\",\n" +
                "                            \"i18nKey\": \"route.plugin_print\",\n" +
                "                            \"icon\": \"mdi:printer\"\n" +
                "                        }\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"name\": \"plugin_sweetalert2\",\n" +
                "                        \"path\": \"/plugin/sweetalert2\",\n" +
                "                        \"component\": \"view.plugin_sweetalert2\",\n" +
                "                        \"meta\": {\n" +
                "                            \"title\": \"plugin_sweetalert2\",\n" +
                "                            \"i18nKey\": \"route.plugin_sweetalert2\",\n" +
                "                            \"icon\": \"pixelarticons:picture-in-picture\"\n" +
                "                        }\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"name\": \"plugin_swiper\",\n" +
                "                        \"path\": \"/plugin/swiper\",\n" +
                "                        \"component\": \"view.plugin_swiper\",\n" +
                "                        \"meta\": {\n" +
                "                            \"title\": \"plugin_swiper\",\n" +
                "                            \"i18nKey\": \"route.plugin_swiper\",\n" +
                "                            \"icon\": \"simple-icons:swiper\"\n" +
                "                        }\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"name\": \"plugin_tables\",\n" +
                "                        \"path\": \"/plugin/tables\",\n" +
                "                        \"meta\": {\n" +
                "                            \"title\": \"plugin_tables\",\n" +
                "                            \"i18nKey\": \"route.plugin_tables\",\n" +
                "                            \"icon\": \"icon-park-outline:table\"\n" +
                "                        },\n" +
                "                        \"children\": [\n" +
                "                            {\n" +
                "                                \"name\": \"plugin_tables_vtable\",\n" +
                "                                \"path\": \"/plugin/tables/vtable\",\n" +
                "                                \"component\": \"view.plugin_tables_vtable\",\n" +
                "                                \"meta\": {\n" +
                "                                    \"title\": \"plugin_tables_vtable\",\n" +
                "                                    \"i18nKey\": \"route.plugin_tables_vtable\",\n" +
                "                                    \"localIcon\": \"visactor\"\n" +
                "                                }\n" +
                "                            }\n" +
                "                        ]\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"name\": \"plugin_typeit\",\n" +
                "                        \"path\": \"/plugin/typeit\",\n" +
                "                        \"component\": \"view.plugin_typeit\",\n" +
                "                        \"meta\": {\n" +
                "                            \"title\": \"plugin_typeit\",\n" +
                "                            \"i18nKey\": \"route.plugin_typeit\",\n" +
                "                            \"icon\": \"mdi:typewriter\"\n" +
                "                        }\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"name\": \"plugin_video\",\n" +
                "                        \"path\": \"/plugin/video\",\n" +
                "                        \"component\": \"view.plugin_video\",\n" +
                "                        \"meta\": {\n" +
                "                            \"title\": \"plugin_video\",\n" +
                "                            \"i18nKey\": \"route.plugin_video\",\n" +
                "                            \"icon\": \"mdi:video\"\n" +
                "                        }\n" +
                "                    }\n" +
                "                ]\n" +
                "            },\n" +
                "            {\n" +
                "                \"name\": \"user-center\",\n" +
                "                \"path\": \"/user-center\",\n" +
                "                \"component\": \"layout.base$view.user-center\",\n" +
                "                \"meta\": {\n" +
                "                    \"title\": \"user-center\",\n" +
                "                    \"i18nKey\": \"route.user-center\",\n" +
                "                    \"hideInMenu\": true\n" +
                "                }\n" +
                "            }\n" +
                "        ],\n" +
                "        \"home\": \"home\"\n" +
                "    }";
        LoginUser loginUser = tokenService.getLoginUser(request);
        if (StringUtils.isNotNull(loginUser))
        { JSONObject jsonObject = JSONObject.parseObject(jsonStr);
            return R.ok(jsonObject,"请求成功");
        }
       return R.ok();
    }

    /**
     * 获取固定的路由数据(不需要权限)
     *
     * @param request
     * @return
     */
    @GetMapping("getConstantRoutes")
    public R<?> getConstantRoutes(HttpServletRequest request){
        String jsonString = "[\n" +
                "        {\n" +
                "            \"name\": \"login\",\n" +
                "            \"path\": \"/login/:module(pwd-login|code-login|register|reset-pwd|bind-wechat)?\",\n" +
                "            \"component\": \"layout.blank$view.login\",\n" +
                "            \"props\": true,\n" +
                "            \"meta\": {\n" +
                "                \"title\": \"login\",\n" +
                "                \"i18nKey\": \"route.login\",\n" +
                "                \"constant\": true,\n" +
                "                \"hideInMenu\": true\n" +
                "            }\n" +
                "        },\n" +
                "        {\n" +
                "            \"name\": \"403\",\n" +
                "            \"path\": \"/403\",\n" +
                "            \"component\": \"layout.blank$view.403\",\n" +
                "            \"meta\": {\n" +
                "                \"title\": \"403\",\n" +
                "                \"i18nKey\": \"route.403\",\n" +
                "                \"constant\": true,\n" +
                "                \"hideInMenu\": true\n" +
                "            }\n" +
                "        },\n" +
                "        {\n" +
                "            \"name\": \"404\",\n" +
                "            \"path\": \"/404\",\n" +
                "            \"component\": \"layout.blank$view.404\",\n" +
                "            \"meta\": {\n" +
                "                \"title\": \"404\",\n" +
                "                \"i18nKey\": \"route.404\",\n" +
                "                \"constant\": true,\n" +
                "                \"hideInMenu\": true\n" +
                "            }\n" +
                "        },\n" +
                "        {\n" +
                "            \"name\": \"500\",\n" +
                "            \"path\": \"/500\",\n" +
                "            \"component\": \"layout.blank$view.500\",\n" +
                "            \"meta\": {\n" +
                "                \"title\": \"500\",\n" +
                "                \"i18nKey\": \"route.500\",\n" +
                "                \"constant\": true,\n" +
                "                \"hideInMenu\": true\n" +
                "            }\n" +
                "        }\n" +
                "    ]";
        JSONArray jsonArray = JSONArray.parseArray(jsonString);
        return R.ok(jsonArray,"请求成功");
    }
}
